// Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
// Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license


.slds-card,
.slds-card-wrapper,
.slds-modal,
.slds-tabs_default,
.slds-tabs--default,
.slds-tabs_card,
.slds-tabs_card.slds-tabs_card {

  // Make cards inside these elements render invisibly.
  .slds-card,
  .slds-card-wrapper {
    border: 0;
    box-shadow: none;
  }
}

// Bring cards back from the dead and give them a border when needed
.slds-card,
.slds-modal,
.slds-tabs_default,
.slds-tabs--default {
  /**
   * @summary Used to bring back the border on a card when needed
   * @selector .slds-card_boundary
   * @restrict .slds-card
   */
  .slds-card_boundary {
    border-width: var(--slds-c-card-sizing-border, var(--sds-c-card-sizing-border, $border-width-thin));
    border-style: solid;
    border-color: var(--slds-c-card-color-border, var(--sds-c-card-color-border, var(--slds-g-color-border-base-1, #{$card-color-border})));
    border-radius: var(--slds-c-card-radius-border, var(--sds-c-card-radius-border, $border-radius-medium));
  }
}

/**
 * @summary This class allows default tabs to appear to be in a card
 * @selector .slds-tabs_card
 * @restrict div
 * @internal
 */
.slds-tabs_card,
.slds-tabs_card.slds-tabs_card {
  padding: $var-spacing-vertical-small $var-spacing-horizontal-medium; // Use card tokens to keep this tab style looking like a card
  background: var(--slds-c-card-color-background, var(--sds-c-card-color-background,
    var(--slds-g-color-neutral-base-100, #{$card-color-background})));
  border-width: var(--slds-c-card-sizing-border, var(--sds-c-card-sizing-border, $border-width-thin));
  border-style: solid;
  border-color: var(--slds-c-card-color-border, var(--sds-c-card-color-border, var(--slds-g-color-border-base-1, #{$card-color-border})));
  border-radius: var(--slds-c-card-radius-border, var(--sds-c-card-radius-border, $border-radius-medium));
  box-shadow: var(--slds-c-card-shadow, var(--sds-c-card-shadow, $card-shadow));

  // This removes the padding for the plain cards when inside a padded tabset
  .slds-card,
  .slds-card-wrapper {
    padding-left: 0;
    padding-right: 0;
  }

  // Pull cards to edge of already padded tab content area
  .slds-card__header,
  .slds-card__body,
  .slds-card__footer {
    padding-left: 0;
    padding-right: 0;
    margin-left: 0;
    margin-right: 0;
  }

  .slds-card__header {
    padding-top: 0;
  }
}

// Restore cards inside .slds-tabs_card as needed
.slds-tabs_card,
.slds-tabs_card.slds-tabs_card,
.slds-card-wrapper {

  .slds-card_boundary {
    border-width: var(--slds-c-card-sizing-border, var(--sds-c-card-sizing-border, $border-width-thin));
    border-style: solid;
    border-color: var(--slds-c-card-color-border, var(--sds-c-card-color-border,
      var(--slds-g-color-border-base-1, #{$card-color-border})));
    border-radius: var(--slds-c-card-radius-border, var(--sds-c-card-radius-border, $border-radius-medium));

    .slds-card__header {
      padding-top:
        var(--slds-c-card-header-spacing-block-start,
        var(--slds-c-card-header-spacing-blockstart,
        var(--sds-c-card-header-spacing-block-start,
        var(--slds-c-card-header-spacing-block,
        var(--sds-c-card-header-spacing-block, $var-spacing-vertical-small)))));
      padding-right:
        var(--slds-c-card-header-spacing-inline-end,
        var(--slds-c-card-header-spacing-inlineend,
        var(--sds-c-card-header-spacing-inline-end,
        var(--slds-c-card-header-spacing-inline,
        var(--sds-c-card-header-spacing-inline, $var-spacing-horizontal-medium)))));
      padding-bottom:
        var(--slds-c-card-header-spacing-block-end,
        var(--slds-c-card-header-spacing-blockend,
        var(--sds-c-card-header-spacing-block-end,
        var(--slds-c-card-header-spacing-block,
        var(--sds-c-card-header-spacing-block, 0)))));
      padding-left:
        var(--slds-c-card-header-spacing-inline-start,
        var(--slds-c-card-header-spacing-inlinestart,
        var(--sds-c-card-header-spacing-inline-start,
        var(--slds-c-card-header-spacing-inline,
        var(--sds-c-card-header-spacing-inline, $var-spacing-horizontal-medium)))));
    }

    .slds-card__body_inner,
    .slds-card__body--inner {
      padding: 0;
      padding-right:
        var(--slds-c-card-body-spacing-inline-end,
        var(--slds-c-card-body-spacing-inlineend,
        var(--sds-c-card-body-spacing-inline-end,
        var(--slds-c-card-body-spacing-inline,
        var(--sds-c-card-body-spacing-inline, $var-spacing-horizontal-medium)))));
      padding-left:
        var(--slds-c-card-body-spacing-inline-start,
        var(--slds-c-card-body-spacing-inlinestart,
        var(--sds-c-card-body-spacing-inline-start,
        var(--slds-c-card-body-spacing-inline,
        var(--sds-c-card-body-spacing-inline, $var-spacing-horizontal-medium)))));
    }

    .slds-card__footer {
      padding-top:
        var(--slds-c-card-footer-spacing-block-start,
        var(--slds-c-card-footer-spacing-blockstart,
        var(--sds-c-card-footer-spacing-block-start,
        var(--slds-c-card-footer-spacing-block,
        var(--sds-c-card-footer-spacing-block, $var-spacing-vertical-small)))));
      padding-right:
        var(--slds-c-card-footer-spacing-inline-end,
        var(--slds-c-card-footer-spacing-inlineend,
        var(--sds-c-card-footer-spacing-inline-end,
        var(--slds-c-card-footer-spacing-inline,
        var(--sds-c-card-footer-spacing-inline, $var-spacing-horizontal-medium)))));
      padding-bottom:
        var(--slds-c-card-footer-spacing-block-end,
        var(--slds-c-card-footer-spacing-blockend,
        var(--sds-c-card-footer-spacing-block-end,
        var(--slds-c-card-footer-spacing-block,
        var(--sds-c-card-footer-spacing-block, $var-spacing-vertical-small)))));
      padding-left:
        var(--slds-c-card-footer-spacing-inline-start,
        var(--slds-c-card-footer-spacing-inlinestart,
        var(--sds-c-card-footer-spacing-inline-start,
        var(--slds-c-card-footer-spacing-inline,
        var(--sds-c-card-footer-spacing-inline, $var-spacing-horizontal-medium)))));
    }
  }
}
